<template>
	<!-- 搜索商品列表组件 -->
	<view class="search_com_list">
		<view class="search_com_items" v-for="(item,index) in comdatas" :key="index" @click="toitem(item.body.product_id)">
			<!-- :src="`http://${item.image_url}`" -->
			<image :src="`${item.body.image}`" mode=""></image>
			<view class="item_text">
				<text class="search_com_price">
					{{item.body.price}}
				</text>
				<text class="search_com_text">
					{{item.body.name}}
				</text>
			</view>
		</view>

	</view>
</template>
<script>
	export default {
		props: {
			comdatas: Array
		},
		data() {
			return {}
		},
		mounted() {},
		components: {},

		methods: {
			toitem(id) {
				console.log("comdatas",this.comdatas)
				uni.navigateTo({
					// url:
					url:`/pages/items/items?itemId=${encodeURIComponent(id)}`
				})
			}
		}
	}
</script>

<style>
	.search_com_list {
		width: 100%;
		padding: 0 30rpx;
	}

	.search_com_items {
		width: 50%;
		height: auto;
		max-height: 520rpx;
		overflow: hidden;
		display: inline-block;
		text-align: center;
		justify-content: center;
		background-color: white;
	}

	.search_com_items image {
		width: 290rpx;
		height: 290rpx;
		padding: 10rpx;
		background-color: #efefef;
		display: block;
	}

	.item_text {
		width: 300rpx;
	}

	.search_com_text {
		font-size: 12px;
	}

	.search_com_price {
		display: inline-block;
		margin: 10rpx;
		padding: 10rpx;
		font-size: 18px;
		color: red;
		outline: 2rpx solid red;
	}
</style>